<!--<?php
include_once PrintEot('left');
print <<<EOT
-->
<script type="text/javascript">
function ifcheck(name){
	var obj = document.getElementsByName(name);
	for(var i=0;i<obj.length;i++){
		if(obj[i].checked){
			return confirm('确认要进行此操作吗？')
		}
	}
	alert("请选择要进行操作的项");
	return false;
}
</script>
<!--
EOT;
if (empty($action)) {
print <<<EOT
-->
<div class="nav3 mb10">
    <ul id="basictype" class="cc">
        <li class="current"><a href="$basename" hidefocus="true">字段管理</a></li>
    </ul>
</div>
<form action="$basename&" method="post">
<input type="hidden" name="step" value="2">
<h2 class="h1">字段管理</h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2 vt">
		<td width="150">字段名称</td>
		<td width="150">应用范围</td>
		<td>操作</td>
	</tr>
<!--
EOT;
foreach ($fieldsList as $key => $value) {
foreach ($value as $k => $v) {print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td2">{$v['name']}</td>
		<td class="td2">{$v['descript']}</td>
		<td class="td2"><a href="$basename&action=field&id=$k">[编辑]</a></td>
	</tr>
<!--
EOT;
}}print <<<EOT
-->
</table>
</div>
</form>
<!--
EOT;
} elseif ($action == 'field') {print <<<EOT
-->
<div class="nav3 mb10">
    <ul id="basictype" class="cc">
        <li class="current"><a href="$basename" hidefocus="true">字段管理</a></li>
    </ul>
</div>
<!--
EOT;
$fieldunit = '';
if ($fieldtype == 'range') {
if ($id == 'sellprice'){
	$fieldunit = '(单位:万)';
}elseif($id == 'rentprice'){
	$fieldunit = '(单位:元)';
}
print <<<EOT
-->
<script src="js/global.js" language="JavaScript"></script>
<script src="js/pw_ajax.js" language="JavaScript" type="text/javascript"></script>
<table style="display:none">
	<tbody id="p_mode"><tr class="tr1 vt">
		<td width="60" class="td2"><input type="text" name="vstart[]" class="input" size="6" /></td>
		<td width="20" class="td2">---</td>
		<td width="60" class="td2"><input type="text" name="vend[]" class="input" size="6" /></td>
		<td width="160" class="td2">显示为 <input type="text" name="fieldvalue[]" class="input" size="15" /></td>
		<td class="td2"><a href="javascript:;" onclick="deltbody(this);" class="s4">[删除]</a></td>
	</tr></tbody>
</table>
<form action="$basename&action=field" method="post" name="FORM">
<input type="button" name="ajaxsub" id="ajaxsub" style="display:none" onclick="ajax.submit(this.form,function(){document.FORM.removeAttribute('target')});"/>
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="step" value="2">
<h2 class="h1"><span class="fl mr10">{$fieldsList[$flag][$id]['name']}管理<span>{$fieldunit}</span></span><span class="linka fl"><a class="btn_add" id="td_field" onclick="addtbody('p_mode','p_body')"><i>添加</i></a></span></h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2 vt">
		<td class="td2">区间最小值</td>
		<td class="td2"></td>
		<td class="td2">区间最大值</td>
		<td class="td2">前台显示文字</td>
		<td class="td2"></td>
	</tr>
<!--
EOT;
foreach ($fielddb as $key => $value) {
!$value['vstart'] && $value['vstart'] = '';
!$value['vend'] && $value['vend'] = '';
print <<<EOT
-->
	<tr class="tr1 vt">
		<td width="60" class="td2"><input type="text" name="vstart[]" value="$value[vstart]" class="input" size="6" /></td>
		<td width="20" class="td2">---</td>
		<td width="60" class="td2"><input type="text" name="vend[]" value="$value[vend]" class="input" size="6" /></td>
		<td width="160" class="td2">显示为 <input type="text" name="fieldvalue[]" value="$value[fieldvalue]" class="input" size="15" /></td>
		<td class="td2"><a href="javascript:;" onclick="if(confirm('确认要删除该数据吗？')){deltbody(this);getObj('ajaxsub').click()}" class="s4">[删除]</a></td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
	<tbody id="p_body"></tbody>
</table>
{$pages}
</div>
<div class="mb10" style="margin-left:10px"><span class="btn"><span><button type="submit" onfocus="blur();">保存设置</button></span></span></div>
</form>
<script language="JavaScript">
function addtbody(mode,tbody){
	if (getObj(mode)) {
		var s = getObj(mode).firstChild.cloneNode(true);
		getObj(tbody).appendChild(s);
	}
}
function deltbody(obj){
	var o = obj.parentNode.parentNode;
	o.parentNode.removeChild(o);
}
addtbody('p_mode','p_body');
</script>
<!--
EOT;
} elseif ($fieldtype == 'area') {print <<<EOT
-->
<script language="JavaScript" src="js/global.js"></script>
<script language="JavaScript" src="js/pw_ajax.js"></script>
<form action="$basename&action=operate" method="post" name="FORM">
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="step" value="2">
<h2 class="h1"><span class="fl mr10">{$fieldsList[$flag][$id]['name']}管理 | <a href="$basename&action=area">行政区划库</a></span> <span class="linka fl"><a class="btn_add" id="td_field" onclick="read.open('menu_field', this.id, 2)"><i>添加</i></a></span></h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2 vt">
		<td width="40"><span onclick="CheckAll(document.FORM);" class="cp">全选</span></td>
		<!--<td width="100">区域代号</td>
		--><td>区域名称</td>
		<td width="120">状态</td>
		<td width="120">操作</td>
	</tr>
<!--
EOT;
foreach ($fielddb as $key => $value) {print <<<EOT
-->
	<tr class="tr1 vt">
		<td width="40" class="td2"><input type="checkbox" name="selid[]" value="$value[id]" /></td>
		<!--<td width="100" class="td2">$value[code]</td>
		--><td class="td2">$value[name]</td>
		<td class="td2">
<!--
EOT;
if ($value['ifopen']) {print <<<EOT
-->
			<span class="s3">已开启</span>
<!--
EOT;
} else {print <<<EOT
-->
			<span class="s1">已停用</span>
<!--
EOT;
}print <<<EOT
-->
		</td>
		<td width="120" class="td2"><a class="mr10" href="$basename&action=editarea&id=$value[id]" id="field_$value[id]" onclick="sendmsg(this.href,'',this.id);return false;">[编辑]</a> <a href="$basename&action=delfield&type=area&id=$value[id]" id="delfield_$value[id]" onclick="sendmsg(this.href,'',this.id);return false;">[删除]</a></td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
</div>

<div class="mb10 cc">
$pages
</div>
<div class="mb10 tac">
	<p class="mb10">操作: <input type="radio" name="job" value="open" checked />启用 <input type="radio" name="job" value="close" />停用 <input type="radio" name="job" value="del" />删除</p>
	<p><span class="bt"><span><button type="button" onclick="CheckAll(document.FORM);" onfocus="blur();">全选</button></span></span>
    <span class="btn"><span><button type="submit" onfocus="blur();"  onclick="return ifcheck('selid[]')">提 交</button></span></span></p>
</div>
</form>

<div id="menu_field" class="menu" style="display:none">
<form action="$basename&action=field" method="post">
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="step" value="2" />
	<div class="admin_table mb10" style="width:400px">
	<h2 class="h1" onmousedown="read.move(event);" style="cursor:move"><a class="del_img fr" href="javascript:;" onclick="closep();">关闭</a>添加所属区域</h2>
	<table width="100%" cellspacing="0" cellpadding="0">
		<!--<tr class="tr1 vt">
			<td class="td2">区域代号</td>
			<td class="td2"><input type="text" name="code" class="input input_wa" /></td>
		</tr>-->
		<tr class="tr1 vt">
			<td class="td2">区域名称</td>
			<td class="td2"><input type="text" onkeydown="if(window.event.keyCode==13) return false;" name="name" value="" class="input input_wa" /></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td2">状态</td>
			<td class="td2"><input type="radio" name="ifopen" value="1" checked />启用 <input type="radio" name="ifopen" value="0" />停用</td>
		</tr>
	</table>
	</div>
	<div class="mb10 tac"><span class="btn2"><span><button type="button" onfocus="blur();" onclick="ajax.submit(this.form)">提 交</button></span></span></div>
</form>
</div>
<!--
EOT;
} else {print <<<EOT
-->
<script language="JavaScript" src="js/global.js"></script>
<script language="JavaScript" src="js/pw_ajax.js"></script>
<form action="$basename&action=operate" method="post" name="FORM">
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="step" value="2">
<h2 class="h1"><span class="fl mr10">{$fieldsList[$flag][$id]['name']}管理</span><span class="fl linka"><a class="btn_add" id="td_field" onclick="read.open('menu_field', this.id, 2)"><i>添加</i></a></span></h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2 vt">
		<td width="40"><span onclick="CheckAll(document.FORM);" class="cp">全选</span></div></td>
		<td width="80">顺序</td>
		<td>选项名称</td>
<!--
EOT;
if($id == 'plate') {print <<<EOT
-->				
		
		<td>所属区域</td>
<!--
EOT;
}print <<<EOT
-->			
		<td width="120">状态</td>
		<td width="120">操作</td>
	</tr>
<!--
EOT;
$i = 1;
foreach ($fielddb as $key => $value) {print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td2"><input type="checkbox" name="selid[]" value="$value[id]" /></td>
		<td class="td2"><input type="text" name="vieworder[$value[id]]" value="{$value[vieworder]}" size="1" class="input" /></td>
		<td class="td2">$value[fieldvalue]</td>
<!--
EOT;
if($id == 'plate') {
$parent = $value['parent'];
$areaname = $areaList[$parent][name] ? $areaList[$parent][name] : '';
print <<<EOT
-->				
		
		<td  class="td2">$areaname</td>
<!--
EOT;
}print <<<EOT
-->
		<td class="td2">
<!--
EOT;
if ($value['ifopen']) {print <<<EOT
-->
			<span class="s3">已开启</span>
<!--
EOT;
} else {print <<<EOT
-->
			<span class="s1">已停用</span>
<!--
EOT;
}print <<<EOT
-->
		</td>
		<td class="td2"><a class="mr10" href="$basename&action=edit&type=$id&id=$value[id]" id="field_$value[id]" onclick="sendmsg(this.href,'',this.id);return false;">[编辑]</a> <a href="$basename&action=delfield&type=$id&id=$value[id]" id="delfield_$value[id]" onclick="sendmsg(this.href,'',this.id);return false;">[删除]</a></td>
	</tr>
<!--
EOT;
$i++;
}
$maxVieworder = $maxVieworder + 1;
print <<<EOT
-->
</table>
<div class="mb10 cc">
$pages
</div>
</div>
<div class="mb10 tac">
	<p class="mb10">操作: <input type="radio" name="job" value="open" checked />启用 <input type="radio" name="job" value="close" />停用 <input type="radio" name="job" value="del" />删除</p>
	<p><span class="bt"><span><button type="button" onclick="CheckAll(document.FORM);" onfocus="blur();">全选</button></span></span>
    <span class="btn"><span><button type="submit" onfocus="blur();"  onclick="return ifcheck('selid[]')">提 交</button></span></span></p>
</div>
</form>
<div id="menu_field" class="menu" style="display:none">
<form action="$basename&action=field" method="post">
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="step" value="2" />
	<div class="admin_table mb10" style="width:400px">
	<h2 class="h1" onmousedown="read.move(event);" style="cursor:move"><a class="del_img fr" href="javascript:;" onclick="closep();">关闭</a>添加字段内容</h2>
	<table width="100%" cellspacing="0" cellpadding="0">
<!--
EOT;
if($id == 'plate') {print <<<EOT
-->				
		
		<tr class="tr1 vt">
			<td class="td2">所属区域</td>
			<td class="td2">
				<select name="area">
<!--
EOT;
foreach ($areaList as $key=>$value) {print <<<EOT
-->				
					<option value="$key">$value[name]</option>
<!--
EOT;
}print <<<EOT
-->						
					
				</select>
			</td>
		</tr>
<!--
EOT;
}print <<<EOT
-->		
		<tr class="tr1 vt">
			<td class="td2">选项名称</td>
			<td class="td2"><input type="text" name="fieldvalue" class="input input_wa" /></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td2">顺序</td>
			<td class="td2"><input type="text" name="vieworder" value="{$maxVieworder}" class="input input_wa" /></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td2">状态</td>
			<td class="td2"><input type="radio" name="ifopen" value="1" checked />启用 <input type="radio" name="ifopen" value="0" />停用</td>
		</tr>
	</table>
	</div>
	<div class="mb10 tac"><span class="btn2"><span><button type="button" onfocus="blur();" onclick="ajax.submit(this.form)">提 交</button></span></span></div>
</form>
</div>
</div>
<!--
EOT;
}} elseif ($action == 'area') {print <<<EOT
-->
<div class="nav3 mb10">
    <ul id="basictype" class="cc">
        <li class="current"><a href="$basename" hidefocus="true">字段管理</a></li>
    </ul>
</div>
<form action="$basename&action=area" method="post">
<h2 class="h1"><span class="fl mr10"><a href="$basename&action=field&id=area">所属区域管理</a></span> | 行政区划库</h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr1 vt">
		<td width="120" class="td2">省 
			<select name="province" onchange="changeCity(this.value);">
				<option></option>
<!--
EOT;
foreach ($provincedb as $key => $value) {print <<<EOT
-->
				<option value="$key">$value</option>
<!--
EOT;
}print <<<EOT
-->
			</select>
		</td>
		<td width="200" class="td2">市 <select name="city" id="sel_city" style="width:80px"><option></option></select></td>
		<td class="td2"><span class="bt2"><span><button type="submit" onfocus="blur();">查 找</button></span></span></td>
	</tr>
</table>
</div>
</form>
<form action="$basename&action=area" method="post" name="FORM">
<input type="hidden" name="step" value="3" />
<input type="hidden" name="province" value="$province" />
<input type="hidden" name="city" value="$city" />
<input type="hidden" name="page" value="$page" />
<h2 class="h1">搜索结果</h2>
<div class="admin_table mb10 cc">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2 vt">
		<td width="40"><span onclick="CheckAll(document.FORM);" class="cp">全选</span></td>
		<!--<td width="100">区域代号</td>
		--><td>区域名称</td>
		<td>状态</td>
	</tr>
<!--
EOT;
foreach ($list as $key => $value) {print <<<EOT
-->
	<tr class="tr1 vt">
		<td width="40" class="td2"><input type="checkbox" name="selid[]" value="$key" /></td>
		<!--<td width="100" class="td2">$key</td>
		--><td class="td2">$value</td>
		<td class="td2">
<!--
EOT;
if (isset($areadb[$key])) {print <<<EOT
-->
			<span class="s3">已导入</span>
<!--
EOT;
} else {print <<<EOT
-->
			<span class="s2">未导入</span>
<!--
EOT;
}print <<<EOT
-->
		</td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
</div>
<div class="mb10 cc">
$pages
</div>
<div class="mb10 tac">
    <span class="bt"><span><button type="button" onclick="CheckAll(document.FORM);" onfocus="blur();">全选</button></span></span>
    <span class="btn"><span><button type="submit" onfocus="blur();">导 入</button></span></span></div>
</form>
<script language="JavaScript" src="js/pw_ajax.js"></script>
<script language="JavaScript">
var jscity = '$jscity';
var parseCity = null;
function changeCity(v) {
	var sel_city = getObj('sel_city');
	sel_city.length = 1;
	if (parseCity == null)
		parseCity = JSONParse(jscity);

	var j = 1;
	if (typeof parseCity[v] != 'undefined') {
		for (var i in parseCity[v]) {
			if (typeof parseCity[v][i] != 'undefined') {
				sel_city.options[j++] = new Option(parseCity[v][i], i);
			}
		}
	}
}
</script>
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->